package internal

import (
	"github.com/name5566/leaf/module"
	"lol.com/feb214-game/nest.git/log"
	"talent.com/cube/common/cxt"
	"talent.com/cube/conf/g"
	"talent.com/cube/modules/game/internal/table"
)

var skeleton = cxt.LobbySkeleton

type Module struct {
	*module.Skeleton
}

func (m *Module) OnInit() {
	m.Skeleton = skeleton
	//扇出同步到数据库到的协程
	for _, ch := range cxt.AllSyncChannel() {
		go table.SyncCredit2DB(ch)
	}
}

func (m *Module) OnDestroy() {
	g.ServerCloseWG.Wait()
	log.Info("game server shutdown")
}
